<!doctype html>
<html>
<head>
<script type='text/javascript'>
function save_options() {
  //+++Plan1+++
  if(document.getElementById("p1").checked == true) {
    localStorage['p1_en'] = 1;
  }

  if(document.getElementById("p1").checked == false) {
    localStorage['p1_en'] = 0;
  }
    
  //+++Plan2+++
  if(document.getElementById("p2").checked == true) {
    localStorage['p2_en'] = 1;
  }
  if(document.getElementById("p2").checked == false) {
    localStorage['p2_en'] = 0;
  }
}

// Restores select box state to saved value from localStorage.
function restore_options() {
  var p1_opt = localStorage['p1_en'];
  if (p1_opt == 0) {
    document.getElementById('p1').checked = false;
  } else {
    var select = document.getElementById('p1');
    select.checked = true; localStorage['p1_en'] = 1;
  }

  var p2_opt = localStorage['p2_en'];
  if (p2_opt == 0) {
    document.getElementById('p2').checked = false;
  } else {
    var select = document.getElementById('p2');
    select.checked = true; localStorage['p2_en'] = 1;
  }
}

</script>
</head>
<body onload="restore_options()">
<div style="width:150px">
<input type="radio" name="plans" value="" id="p1" onclick="save_options()"/> Plan1 <br/>
<input type="radio" name="plans" value="" id="p2" onclick="save_options()"/> Plan2 
</div>
</body>
</html>
